const winston = require('winston');
const formatDate = require('./formatDate')
const path = require('path');
let date = formatDate.getFormatDate();
// winston.add(winston.transports.File, { filename: '../log/winston.log' });

var logger = new (winston.Logger)({
  transports: [
    new (winston.transports.File)({
      name: 'error-file',
      filename: path.join(__dirname, '../../log/error',date+'.log'),
      level: 'error'
    }),
    new (winston.transports.File)({
        name: 'info-file',
        filename: path.join(__dirname, '../../log/info',date+'.log'),
        level: 'info'
    }),
    new (winston.transports.Console)()
  ]
});

module.exports = logger;